package com.day2;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ck")
public class Cookie2 extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.service(req, resp);
        Cookie ck=new Cookie("ck","haha");
        Cookie ck1=new Cookie("ck1","haha1");
        Cookie ck2=new Cookie("ck2","haha2");
        resp.getWriter().print("hahhdh");
//        ck.setMaxAge(10);
        resp.addCookie(ck);
        resp.addCookie(ck1);
        resp.addCookie(ck2);
//        resp.sendRedirect(path+"/ck1");
    }
}
